package org.apache.hadoop.sangbu.rpc;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.ipc.RPC;

import java.io.IOException;
import java.net.InetSocketAddress;

/*
 * <p>描述: 访问RPC服务</p>
 * <p>创建时间: ${date} ${time} </p>
 * <p>公司信息: <a href="https://www.zcah.com.cn/">中国信息安全测评中心-中测安华</a> </p>
 * @author <a href="mail to: sangjiacun@secemail.com" rel="nofollow">桑甲存</a>
 * @version v1.0
 */
public class Client {
    public static void main(String[] args) throws IOException {
        //1. 拿到RPC协议
        ClicentNameNodeProtocol proxy = RPC.getProxy(ClicentNameNodeProtocol.class, 1L,
                new InetSocketAddress("localhost", 7777), new Configuration());
        //2. 发送请求
        String metaData = proxy.getMetaData("/meta");
        //3. 打印元数据
        System.out.println(metaData);
    }
}
